﻿using BankCreditPortfolio.DAL.Entities;
using System.Linq;

namespace BankCreditPortfolio.DAL.Services
{
    public class AccountService : DataService<Account>
    {
        public Account GetByEmail(string email)
        {
            var filteredQuery = this.CreateQuery().Where(x => x.Email == email);
            return filteredQuery.Count() > 0 ? filteredQuery.Single() : null;
        }
        
        public Role GetRoleByEmail(string email)
        {
            var filteredQuery = this.CreateQuery().Where(x => x.Email == email);
            return filteredQuery.Count() > 0 ? filteredQuery.Single().Role : null;
        }
    }
}